//
//  XBMatchExample.c
//  数据结构算法和笔试题
//
//  Created by 王国栋 on 16/6/24.
//  Copyright © 2016年 xiaobai. All rights reserved.
//

#include "XBMatchExample.h"

static int e[101][101];
static int match[101];
static int book[101];
static int n,m;

int  dfs(int u)
{
        for (int i =1; i<=n; i++) {
        
        if (book[i]==0&&e[u][i]==1) {
            
            book[i]=1;
            if (match[i]==0||dfs(match[i])) {
                
                match[u]=i;
                match[i]=u;
                return 1;
            }
        }
    }
    return 0;
}
void matchTest()
{
    int i,j,t1,t2,sum =0;
    
    scanf("%d %d",&n,&m);
    for (int i =1; i<=m; i++) {
        
        scanf("%d %d",&t1,&t2);
        e[t1][t2]=1;
        e[t2][t1]=1;
    }
    for (int i =1; i<=n; i++) {
        
        match[i]=1;
    }
    for (int i =1; i<=n; i++) {
        
        for (int j=1; j<=n; j++) {
            
            book[j]=0;
            if (dfs(i)) {
                
                sum++;
            }
        }
    }
    
    
}





